'use strict'
import { ScrollView } from '../../component'
import style from './css.css'
import Item from './headerItem'
class Header extends React.Component {
  static propTypes = {
    banners: PropTypes.array,
    history: PropTypes.object
  }
  _renderList () {
    const { history, banners } = this.props
    if (banners.length > 0) {
      return banners.slice().map((item, index) => { return (<Item history={history} item={item} key={index} />) })
    }
  }
  render () {
    return (
      <ScrollView direction = "row" scrollbars = {false} className={style.header}>
        {this._renderList()}
      </ScrollView>
    )
  }
}

export default Header
